package com.project.erp.model.fobcost;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.struts2.json.annotations.JSON;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.project.erp.model.IdEntity;

/**
 * FOB成本细表
 * 
 * 使用JPA annotation定义ORM关系. 使用Hibernate annotation定义JPA 1.0未覆盖的部分.
 * 
 * @author lijiaguo
 * @date 2013-10-18 22:47
 */
@Entity
// 表名与类名不相同时重新定义表名.
@Table(name = "TBL_FOB_COST_DETAIL")
// 默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class FobCostDetail extends IdEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -237737998575401218L;

	private String itemEn;//细项项目（英文）
	private String itemZn;//细项项目（中文）
	private Boolean isBaseonInvo;//是否按票计算费用
	private Double amount;//金额
	private String createUser;//创建用户
	private Date createTime;//创建时间
	private String updateUser;//更新用户
	private Date updateTime;//更新时间
	private FobCost fobCost;
	
	private Date startTime; //开始时间,用于查询，不作为数据字段
	private Date endTime;//结束时间,用于查询，不作为数据字段

	public FobCostDetail() {
	}

	public FobCostDetail(String itemEn, String itemZn, Boolean isBaseonInvo,
			Double amount, String createUser, Date createTime,
			String updateUser, Date updateTime,
			Date startTime, Date endTime) {
		super();
		this.itemEn = itemEn;
		this.itemZn = itemZn;
		this.isBaseonInvo = isBaseonInvo;
		this.amount = amount;
		this.createUser = createUser;
		this.createTime = createTime;
		this.updateUser = updateUser;
		this.updateTime = updateTime;
		this.startTime = startTime;
		this.endTime = endTime;
	}



	public String getItemEn() {
		return itemEn;
	}

	public void setItemEn(String itemEn) {
		this.itemEn = itemEn;
	}

	public String getItemZn() {
		return itemZn;
	}

	public void setItemZn(String itemZn) {
		this.itemZn = itemZn;
	}

	public String getCreateUser() {
		return createUser;
	}

	public Boolean getIsBaseonInvo() {
		return isBaseonInvo;
	}

	public void setIsBaseonInvo(Boolean isBaseonInvo) {
		this.isBaseonInvo = isBaseonInvo;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}

	@ManyToOne
	@JoinColumn(name="fob_id",nullable=false)
	@org.hibernate.annotations.ForeignKey(name="fk_fob_fobdtl")
	@org.hibernate.annotations.Index(name="idx_fk_fob_fobdtl")
	public FobCost getFobCost() {
		return fobCost;
	}

	public void setFobCost(FobCost fobCost) {
		this.fobCost = fobCost;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Transient
	@JSON(format="yyyy-MM-dd HH:mm:ss")
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	@Transient
	@JSON(format="yyyy-MM-dd HH:mm:ss")
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}
}
